//
// Created by haoy on 2017/6/27.
//

#ifndef RTC_XSWITCH2_RTC_RECORDER_H
#define RTC_XSWITCH2_RTC_RECORDER_H

#include <string>

struct rtc_endpoint_st;
typedef rtc_endpoint_st* rtc_endpoint_t;

struct xmixer_st;
typedef xmixer_st* xmixer_t;

class rtc_recorder;
typedef rtc_recorder* rtc_recorder_t;

extern int RTC_RECORDER_TLV_REUSED;
rtc_recorder_t rtc_recorder_new(const std::string &job_path, const std::string& tlv_path);
void rtc_recorder_delete(rtc_recorder_t rec);
void rtc_recorder_on_internal_source_closed(rtc_recorder_t rec, const std::string& internal_source_name);
void rtc_recorder_check_timeout(rtc_recorder_t rec, uint64_t now);
int rtc_recorder_new_scene(rtc_recorder_t rec, std::string &name, int priority, const std::string &type, const std::string &ctx, int timeout_ms, const std::string& sub_dir);
int rtc_recorder_delete_scene(rtc_recorder_t rec, const std::string &name);
int rtc_recorder_open_segment(rtc_recorder_t rec, const std::string &scene_name, const std::string &source_name, std::string &segment_name,
                              const std::string& tlv_rel_pathname, const std::string& internal_source_name , bool audio, bool video);
int rtc_recorder_close_segment(rtc_recorder_t rec, const std::string &scene_name, const std::string &source_name, const std::string &segment_name);
int rtc_recorder_get_tlv_filename(rtc_recorder_t rec, const std::string &scene_name, const std::string& internal_source_name, std::string &tlv_filename);
int rtc_recorder_update_ctx(rtc_recorder_t rec, const std::string& scene_name, const std::string& ctx);

#endif //RTC_XSWITCH2_RTC_RECORDER_H
